//
//  CollectionCell.m
//  reader
//
//  Created by mo on 2021/12/13.
//  Copyright © 2021 mo. All rights reserved.
//

#import "CollectionCell.h"
#import "Masonry.h"

@interface CollectionCell()

@end

@implementation CollectionCell

- (id)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    
    _view = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)];
    _view.layer.masksToBounds = YES;
    _view.layer.cornerRadius = 10;
    _view.contentMode = UIViewContentModeScaleToFill;
    _view.backgroundColor = [UIColor whiteColor];
    // 尺寸改变时重绘
    CGRect screenBounds = [[UIScreen mainScreen] bounds];
    [self.contentView addSubview:_view];
    [_view mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(screenBounds.size.width/5,screenBounds.size.width/5));
        make.top.equalTo(self.mas_top).offset(screenBounds.size.height/60);
        make.left.equalTo(self.mas_left).offset(screenBounds.size.width/20);
    }];

    _name = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 0, 0)];
    _name.font = [UIFont systemFontOfSize:30];
    [self.contentView addSubview:_name];
    [_name mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(screenBounds.size.width/2,screenBounds.size.width/11));
        make.top.equalTo(self.mas_top).offset(screenBounds.size.height/60);
        make.left.equalTo(_view.mas_right).offset(screenBounds.size.width/20);
    }];
    
    _sign = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 0, 0)];
    _sign.textColor = [UIColor grayColor];
    [self.contentView addSubview:_sign];
    [_sign mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(screenBounds.size.width/2,screenBounds.size.width/11));
        make.bottom.equalTo(self.mas_bottom).offset(screenBounds.size.height/60);
        make.left.equalTo(_view.mas_right).offset(screenBounds.size.width/20);
    }];
    
    
    return self;
}

@end
